<main>
    <div class="form-box">
        <h3>B端价格设置</h3>
        <nz-form-item>
            <nz-form-label nz-col nzRequired>
                单个售价
            </nz-form-label>
            <nz-form-control nz-col nzFlex="200px">
                <nz-input-number [nzMin]="0.01" [(ngModel)]="entityParam.shopPriceB" nzPlaceHolder="请输入单个售价">
                </nz-input-number>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label nz-col>
                最小购买值
            </nz-form-label>
            <nz-form-control nz-col nzFlex="200px">
                <nz-input-number [nzMin]="1" [(ngModel)]="entityParam.buyMinB" nzPlaceHolder="请输入最小购买值">
                </nz-input-number>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label nz-col>
                最大购买值
            </nz-form-label>
            <nz-form-control nz-col nzFlex="200px">
                <nz-input-number [nzMin]="0" [nzMax]="999" [(ngModel)]="entityParam.buyMaxB" nzPlaceHolder="请输入最大购买值">
                </nz-input-number>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label nz-col>
                单个划线价
            </nz-form-label>
            <nz-form-control nz-col nzFlex="200px">
                <nz-input-number [nzMin]="1" [(ngModel)]="entityParam.originalPriceB" nzPlaceHolder="请输入单个划线价">
                </nz-input-number>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label nz-col>
                建议零售价
            </nz-form-label>
            <nz-form-control nz-col nzFlex="200px">
                <nz-input-number [nzMin]="1" [(ngModel)]="entityParam.retailPriceB" nzPlaceHolder="请输入建议零售价">
                </nz-input-number>
            </nz-form-control>
        </nz-form-item>
        <br>
        <h3>C端价格设置</h3>
        <nz-form-item>
            <nz-form-label nz-col nzRequired>
                单个售价
            </nz-form-label>
            <nz-form-control nz-col nzFlex="200px">
                <nz-input-number [nzMin]="0.01" [(ngModel)]="entityParam.shopPriceC" nzPlaceHolder="请输入单个售价">
                </nz-input-number>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label nz-col>
                最小购买值
            </nz-form-label>
            <nz-form-control nz-col nzFlex="200px">
                <nz-input-number [nzMin]="1" [(ngModel)]="entityParam.buyMinC" nzPlaceHolder="请输入最小购买值">
                </nz-input-number>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label nz-col>
                最大购买值
            </nz-form-label>
            <nz-form-control nz-col nzFlex="200px">
                <nz-input-number [nzMin]="0" [nzMax]="999" [(ngModel)]="entityParam.buyMaxC" nzPlaceHolder="请输入最大购买值">
                </nz-input-number>
            </nz-form-control>
        </nz-form-item>
        <nz-form-item>
            <nz-form-label nz-col>
                单个划线价
            </nz-form-label>
            <nz-form-control nz-col nzFlex="200px">
                <nz-input-number [nzMin]="1" [(ngModel)]="entityParam.originalPriceC" nzPlaceHolder="请输入单个划线价">
                </nz-input-number>
            </nz-form-control>
        </nz-form-item>

        <br>
        <h3>第三方售价配置</h3>
        <nz-form-item *ngIf="detailsData.jdId && !isShowJdConfig">
            <nz-form-label nz-col>京东</nz-form-label>
            <button nzTooltipTitle="我方C端售价{{entityParam.shopPriceC}}元" nzTooltipPlacement="top" nz-tooltip nz-button
                nzType="text" (click)="jumpjdPage(entityParam.jdId)">{{ detailsData.jdPrice || 0 }} （<span class="jd-text">{{cacheData.tipsJdPrice || 0}}</span>）</button>
            <a nz-button nzType="link" (click)="onModifyJdConfig()">修改配置<span
                    *ngIf="detailsData.jdId">（{{detailsData.jdId}}）</span></a>
            <a nz-button nzType="link" (click)="onGetJdData()">获取最新售价</a>
        </nz-form-item>
        <nz-form-item *ngIf="!detailsData.jdId || isShowJdConfig">
            <nz-form-label nz-col>京东</nz-form-label>
            <nz-form-control nz-col nzFlex="200px">
                <nz-input-number [nzMin]="1" [(ngModel)]="entityParam.jdId" nzPlaceHolder="请输入">
                </nz-input-number>
            </nz-form-control>
            <!-- <a nz-button nzType="link" (click)="onGetJdData()">确定并抓取数据</a> -->
        </nz-form-item>

        <br>
        <h3>以旧换机补贴配置（每个订单最多五台旧机，建议最低门槛满500）</h3>
        <nz-form-item>
            <nz-form-label nz-col>是否开启</nz-form-label>
              <span style="display: flex;align-items: center">
                <nz-radio-group [(ngModel)]="entityParam.renewalFlag">
                  <label nz-radio [nzValue]="1">开启</label>
                  <label nz-radio [nzValue]="0">关闭</label>
                </nz-radio-group>
              </span>
        </nz-form-item>
        <nz-form-item *ngIf="entityParam.renewalFlag===1">
            <nz-form-label nz-col>补贴规则</nz-form-label>
              <span>
                <div style="display: flex;flex-direction: row;align-items: center">
                  <span style="align-self: flex-start;margin-top: 4px">旧机实际总回收价满</span>
                  <span>
                    <div *ngFor="let subsidy of entityParam.renewalRule;let index=index" style="margin-bottom: 2px">
                    <nz-input-number [nzMin]="1" [nzPrecision]="0" style="width: 80px" [(ngModel)]="subsidy.price" nzPlaceHolder="价格"></nz-input-number>
                    元补贴
                    <nz-input-number [nzMin]="1" [nzPrecision]="0" style="width: 80px" [(ngModel)]="subsidy.allowance" nzPlaceHolder="价格"></nz-input-number>
                    元
                    <i nz-icon nzType="delete" style="color: #ff4d4f" (click)="deleteSubsidy(index)" *ngIf="entityParam.renewalRule.length>1"></i>
                    </div>
                  </span>
                </div>
                <div style="text-align: center;color: #00b7ee;cursor:pointer;" (click)="subsidyAdd()">+添加阶梯</div>
                <div>说明：如果旧机实际验机价与估价不一致，补贴金额以旧机实际验机价为准</div>
              </span>
        </nz-form-item>

    </div>
    <div class="submit-box">
        <nz-divider></nz-divider>
        <div class="bt-box">
            <button nz-button nzType="primary" (click)="submitForm()">保存</button>
            <app-bt-group [btType]="'default'" [btText]="'返回'"></app-bt-group>
        </div>
    </div>
</main>
